#include "Camera.h"

Vector3f Camera::getPosition(){
  return _position;
}

Vector3f Camera::getAngle(){
  return _angle;
}

Vector3f Camera::getFocus(){
  return _focus;
}

void Camera::setPosition(Vector3f pos){
  _position = pos;
}

void Camera::setAngle(Vector3f ang){
  _angle = ang;
}

void Camera::setFocus(Vector3f foc){
  _focus = foc;
}


Camera::Camera (Vector3f pos, Vector3f ang, Vector3f foc) : _position(pos), _angle(ang), _focus(foc)
{
    _emgr = EventManager::getInstance();
}

Camera::~Camera(){}

void Camera::getEvent()
{
    EventManager _emgr = EventManager::getInstance();
    _emgr->getEvent();
    if(_emgr->isKeyDown('A'))
        _position.x+=pas;
    if(_emgr->isKeyDown('Z'))
        _position.y+=pas;
    if(_emgr->isKeyDown('E'))
        _position.z+=pas;
    if(_emgr->isKeyDown('R'))
        _angle.x+=pas;
    if(_emgr->isKeyDown('T'))
        _angle.y+=pas;
    if(_emgr->isKeyDown('Y'))
        _angle.z+=pas;
    if(_emgr->isKeyDown('U'))
        _focus.x+=pas;
    if(_emgr->isKeyDown('I'))
        _focus.y+=pas;
    if(_emgr->isKeyDown('O'))
       _focus.z+=pas;
}
// le code qui suit n a pas ete teste
void Camera::reset(){
  gluLookAt(0,0,0,0,0,0,0,0,0);
}

void Camera::translate(Vector3f v){
  Vector3f pos = getPostion();
  Vector3f ang = getAngle();
  Vector3f ang = getFocus();
  reset();
  setPosition(pos+v);
  setAngle(ang);
  setFocus(foc);
}
